package com.gitee.occo.sso.user.repository;

import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
import org.springframework.stereotype.Repository;

import com.gitee.occo.sso.user.entity.User;

import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

@Repository
public interface UserRepository extends ReactiveCrudRepository<User, Long>{

	@Query("SELECT * FROM user WHERE state = :state")
	Flux<User> findByState(Integer state);
	
	@Query("SELECT * FROM user WHERE username = :username")
	Mono<User> findByUsername(String username);
	
	@Query("SELECT * FROM user WHERE username LIKE :username")
	Flux<User> findByUsernameLike(String username);
}
